//
//  sendFirCirPicture.m
//  tcpoctest
//
//  Created by gump on 5/10/13.
//  Copyright (c) 2013 gump. All rights reserved.
//

#import "sendFirCirPicture.h"

@implementation sendFirCirPicture

-(void)SendFCPicture:(UIImage *)image withNewsID:(NSString *)strnews
{
    //发送 74char(1),2char(1),动态ID字串长度char(1),动态ID字串char(x)，图片数据长度int, 图片数据char(x)
    
    if (![self CheckLogin]) {
        return;
    }
    
    NSData *imagedata = UIImageJPEGRepresentation(image,JPG_COMPRESS_RATE);
    
    int l = CHAR_PL * 3 + INT_PL * 2 + [strnews length] + [imagedata length];
    
    [self initDataByLength:l];
    
    [sb WriteChar:[strnews length]];
    [sb WriteString:strnews withLength:[strnews length]];
    
    [sb WriteInt:[imagedata length] withNTT:NTT_SMALL2BIG];
    [sb WriteData:(char *)[imagedata bytes] withLength:[imagedata length]];
    
    [self Package];
}

@end
